<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="__PUBLIC__/static/uploadify/uploadify.css" rel="stylesheet">
<script type="text/javascript" src="__PUBLIC__/static/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/uploadify/jquery.uploadify.min.js"></script>
</head>
<body>
<!-- 普通上传 -->
<form action="<{:U('File/uploadPicture')}>" enctype="multipart/form-data" method="post" >
	普通表单上传：<br/>
	<input type="file" name="download">
	<br/>
	<button type="submit">提交</button>
</form>
<hr>
<!-- js上传 -->
<form action="" enctype="multipart/form-data" method="post">
	js上传<br/>
	<input type="file" name="file" id="jsup">
</form>
<div id="imgshow"></div>
</body>
<!-- js上传配置文件 -->
<script type="text/javascript">
    $(function() {
        $('#jsup').uploadify({
        	//固定配置项
            'swf'				: '__PUBLIC__/static/uploadify/uploadify.swf',    //指定上传控件的主体文件
            'uploader'			: "<{:U('getjsfile')}>",  //指定服务器端上传处理文件
			'fileObjName'     	: 'file',
			'buttonImage'		: '__PUBLIC__/static/uploadify/uploadify-upload.png', //上传处理文件按钮背景图片
			'width'				: 108,
			'height'			: 28,
			//'buttonClass'		: 'class', //上传class
			//'buttonText'      	: '上传文件',
            //其他配置项
			'fileSizeLimit'		: '0',	//上传文件限制 0问无限制
			'fileTypeDesc'		: 'Image Files', //文件类型
			'fileTypeExts'		: '*.jpg;*.mp3',	//文件后缀
			'onUploadSuccess' 	: uploadSuccess,
			'onUploadError'		: onUploadError,
			'onFallback' 		: function() {
	            alert('未检测到兼容版本的Flash.');
	        }
        });
        function uploadSuccess(file,data){
        	/*console.log(data);
        	var data = JSON.parse(data);
        	console.log(data);
        	var key = data['savepath']+data['savename'];
			console.log(data);
			console.log(data['savepath']);
			console.log(data['savename']);
			console.log(data['ext']);
			console.log(data['size']);
			content = $('#imgshow').html();
			content = content + '<img src="<?php echo OSS ?>'+ key+'">';
			//$('#imgshow').html(content);*/
        }
        function onUploadError(file,data){
        	console.log(data);
        	var data = JSON.parse(data);
        	console.log(data);
        }
    });
</script>
</html>
